#include "zdefs.h"

const char *prelude(void)
{
  static bool key_created = false;
  static pthread_key_t key;
  
  if (!key_created) {
    key_created = true;
    if (pthread_key_create(&key, free)) {
      fprintf(stderr, "*** Error creating thread key!\n");
    }
  }
  char *buf = (char *)pthread_getspecific(key);
  
  if (!buf) {
    buf = (char *)malloc(48);
    sprintf(buf, "auto malloc[%d]", getpid());
    pthread_setspecific(key, buf);
  }
  return (const char *)buf;
}
